package Util;
import org.hibernate.*;
import org.hibernate.cfg.AnnotationConfiguration;
import org.hibernate.cfg.Configuration;
public class HibernetUtil {
	 private static final SessionFactory sessionFactory;

	    static {
	        try {
	            // Cr�er une SessionFactory � partir de hibernate.cfg.xml
	            sessionFactory = new AnnotationConfiguration().configure("/hibenatecfg/hibernet.cfg.xml").buildSessionFactory();
	        } catch (Throwable ex) {
	            // Gestion exception
	            System.err.println("Echec cr�ation SessionFactory" + ex);
	            throw new ExceptionInInitializerError(ex);
	        }
	    }

	    public static SessionFactory getSessionFactory() {
	        return sessionFactory;
	    }


}
